package com.zdoon.springbootmybatis.mapper;

import com.zdoon.springbootmybatis.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

//    @Select("select id, username, password, name, gender, phone, job, salary, image, entry_date, create_time, update_time from emp")
    public List<User> findAll();

    @Delete("delete from emp where id = #{id}")
    public Integer deleteById(Integer id);

    @Insert("insert into emp(username,password,name,gender,phone,job,salary,image) values(#{username},#{password},#{name},#{gender},#{phone},#{job},#{salary},#{image})")
    public Integer insertUser(User user);

    @Update("update emp set username = #{username},password = #{password},name = #{name},gender = #{gender},phone = #{phone},job = #{job},salary = #{salary},image = #{image} where id = #{id}")
    public Integer updateUser(User user);

    @Select("select * from emp where username = #{username} and password = #{password}")
    public User findByUsernameAndPassword(String username, String password);

}

